<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="./styles/general.css" rel="stylesheet" type="text/css" />
<link href="./styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../images/jquery.js"></script>
<style>
table tr td{ text-align:center;}
.testone{ background:red;}
</style>
<title></title>
<script type="text/javascript">
function  check_info(id,check_span_id,td_check_id,length,type)
{
 value = ($('#'+check_span_id).html());
 value = value.replace(/"/g,'&quot;');
 $("#"+check_span_id).remove();
 $("#"+td_check_id).html('<input type="text" id="'+check_span_id+'"  value="'+value+'"   style="width:'+length+'px" />');
 $("#"+check_span_id).focus();
 $("#"+check_span_id).blur( function () 
 { 							  
	 var check_value = $('#'+check_span_id).val();
			
	 if(type == 'price_terms')
	 {
		 check_value = check_value;
	 }	
	 var str ="<span   id='"+check_span_id+"' >"+check_value+"</span>";
	 
	 $("#"+td_check_id).html("");
	 $("#"+td_check_id).html(str);
	 
	 $("#"+check_span_id).mouseout( function () { check_css(check_span_id,0); }); 
	 $("#"+check_span_id).mouseover( function () { check_css(check_span_id,1); }); 
	
	 $("#"+check_span_id).click( function () { check_info(id,check_span_id,td_check_id,length,type); }); 
	 if(check_value!='可在此修改价格说明')
	 {
		  if(type == 'price_terms')
		  {
		
			  $.get("/wondershare/product.php?action=ajax_update_value", { type:type,position_id: id,value:check_value },
			 function(data){
			
				 });  
		  }
				
	  }			
 });

 
}

function  check_css(element_id,type)
{
   if(type==1)
   {
	$("#"+element_id).css({  "background": "blue","color": "#ff0011"}); 
   }
   else
   {
	$("#"+element_id).css({ "background": "","color":""}); 
   }

}
function  change_image(price_id)
	{
	
		var value = 0;
		if($('#price_'+price_id).attr("src") == './images/yes.gif')
		{
		  value = 0;
		 $('#price_'+price_id).attr("src","./images/no.gif"); 
	
		}else
		{
		 value = 1;
		 $('#price_'+price_id).attr("src","./images/yes.gif");  
		}
		
		$.post("./product.php?action=UpdataPriceProduct",{price_id:price_id,value:value},function(data)
		{
		});
	}

function change_son_image(price_id,license_id,product_id)
{
	var value = 0;
		if($('#price_'+price_id).attr("src") == './images/yes.gif')
		{
		  value = 0;
		 $('#price_'+price_id).attr("src","./images/no.gif"); 
		 $.post("./product.php?action=UpdataPriceProduct",{price_id:price_id,value:value},function(data)
		{});
		}else
		{
		 value = 1;
		 $("#table_info").find(".price_license"+license_id).each(function(){$(this).attr("src","./images/no.gif"); });
		  
		 $('#price_'+price_id).attr("src","./images/yes.gif");  
		  $.post("./product.php?action=UpdataSonPriceProduct",{price_id:price_id,value:value,license_id:license_id,product_id:product_id},function(data)
		{});
		}
}
function backgo()
{
	history.back(); 
}

function sync_price_cbs(p_cid,p_id)
{
	if(window.confirm('是否同步CBS价格信息？'))
		{
			location.href="./product.php?action=sync_price_cbs&product_cbsid="+p_cid+"&product_id="+p_id;
		}
		else
		{
			return false;
		}
}
</script>
</head>
<body>
<h1>

<span class="action-span1">
<a href="./product.php?action=productList">公共产品信息管理</a>&nbsp—&nbsp产品价格管理
</span>
</span>
<{if $prod.product_id neq '115'}><input style="float:right; margin-right:10px;" type="button" value="同步CBS版本信息" onclick="sync_price_cbs(<{$prod.product_cbsid}>,<{$prod.product_id}>);"><{/if}>
<div style="clear:both"></div>
</h1>

<h1>
<span class="action-span1">
&nbsp;&nbsp;产品名称：<{$prod.product_name}> &nbsp;&nbsp;&nbsp; 产品编号：<{$prod.product_sn}><br /><br />
&nbsp;&nbsp;&nbsp;价格说明：<span align="center" id="td_price_terms_<{$prod.product_id}>" ><span onmouseout='check_css("price_terms_<{$prod.product_id}>",0);' onmouseover='check_css("price_terms_<{$prod.product_id}>",1);'      
	onclick='check_info("<{$prod.product_id}>","price_terms_<{$prod.product_id}>","td_price_terms_<{$prod.product_id}>","500","price_terms");' id="price_terms_<{$prod.product_id}>" ><{if $prod.price_terms}><{$prod.price_terms|escape}><{else}>可在此修改价格说明<{/if}></span>
	</span>
</span>
<div style="clear:both"></div>
</h1>
<form>
 <{if count($product_price)<=0}>
  <h2 style="text-align:center;">没有数据</h2>
  <{else}>
 <table width="100%" cellspacing="1" cellpadding="2" id="table_info" class="list-div">
    <tr>
      <th width="8%">License ID</th>
      <th width="30%">License</th>
      <th>价格</th>
      <th width="10%">是否在网站显示</th>
      <th width="5%">查看链接</th>
      <th width="10%">操作人员</th>
      <th width="15%">操作时间</th>
    </tr>
    <{foreach from=$product_price key=myID item=product}>
	    <{if $product.sub_license_id == 0}>
		    <tr>
		      <td><{$product.license_id}></td>
		      <td><{$product.license}></td>
		      <td>BRL <{$product.price}> / <{$product.currency_price}></td>
		      <td><img  class="price_license<{$product.license_id}>" id="price_<{$product.id}>" onclick="change_son_image(<{$product.id}>,<{$product.license_id}>,<{$product.product_id}>)" <{if $product.website_display == 1}> src="./images/yes.gif" <{else}> src="./images/no.gif" <{/if}> /></td>
		      <td><a href="./product.php?action=ProductPriceDetail&id=<{$product.id}>&product_id=<{$product.product_id}>">查看</a></td>
		      <td><{$product.operater}></td>
		      <td><{$product.operate_time}></td>
		    </tr>
			<{foreach from=$product_price key=myID item=price}>
				<{if $price.license_id == $product.license_id and $price.sub_license_id > 0}>
				<tr>
			      <td style="background:#CCC"><{$product.license_id}>.<{$price.sub_license_id}></td>
			      <td style="background:#CCC"><{$price.license}></td>
			      <td style="background:#CCC">BRL <{$price.price}> / <{$price.currency_price}></td>
			      <td style="background:#CCC"><img class="price_license<{$product.license_id}>" id="price_<{$price.id}>" onclick="change_son_image(<{$price.id}>,<{$price.license_id}>,<{$price.product_id}>)" <{if $price.website_display == 1}> src="./images/yes.gif" <{else}> src="./images/no.gif" <{/if}> /></td>
			      <td style="background:#CCC"><a href="./product.php?action=ProductPriceDetail&id=<{$price.id}>&product_id=<{$price.product_id}>">查看</a></td>
			      <td style="background:#CCC"><{$product.operater}></td>
		          <td style="background:#CCC"><{$product.operate_time}></td>
			      </tr>
				<{/if}>
			<{/foreach}>
	    <{/if}>
    <{/foreach}>
    <tr>
    <td colspan="5"><{$page_url}> &nbsp;&nbsp;&nbsp; 共有 <span id="total"><{$total}></span>条记录&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="后退" id="goback" onclick="backgo();"></td>
    </tr>
  </table>
<{/if}>
</form>
</body>
</html>
